home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Include / FWPrInfo.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  5.4 KB  |  238 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPrInfo.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPRINFO_H
  11. #define FWPRINFO_H
  12.  
  13. // ----- Foundation Includes -----
  14.  
  15. #ifndef FWSTDDEF_H
  16. #include "FWStdDef.h"
  17. #endif
  18.  
  19. #ifndef FWEXCLIB_H
  20. #include "FWExcLib.h"
  21. #endif
  22.  
  23. // ----- OS Includes -----
  24.  
  25. #ifndef FWGXCFG_H
  26. #include "FWGXCfg.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. // ----- OpenDoc Includes -----
  34.  
  35. #ifndef FWODTYPS_H
  36. #include "FWODTyps.h"
  37. #endif
  38.  
  39. #ifndef SOM_ODTransform_xh
  40. #include <Trnsform.xh>
  41. #endif
  42.  
  43. // ----- Platform -----
  44.  
  45. #if defined(FW_BUILD_MAC) && !defined(__PRINTING__)
  46. #include <Printing.h>
  47. #endif
  48.  
  49. #if defined(FW_SUPPORT_GX) && !defined(__GXTYPES__)
  50. #include <GXTypes.h>
  51. #endif
  52.  
  53. #if defined(FW_SUPPORT_GX) && !defined(__GXPRINTING__)
  54. #include <GXPrinting.h>
  55. #endif
  56.  
  57. #if defined(FW_SUPPORT_GX) && !defined(__GXENVIRONMENT__)
  58. #include <GXEnvironment.h>
  59. #endif
  60.  
  61. //========================================================================================
  62. // Forward class definitions
  63. //========================================================================================
  64.  
  65. class FW_CString;
  66. class FW_CPrintHandler;
  67.  
  68. class ODSession;
  69. class ODStorageUnit;
  70. class ODFrame;
  71. class ODFacet;
  72. class ODCanvas;
  73.  
  74. //========================================================================================
  75. // class FW_CPrintEnvironment
  76. //========================================================================================
  77.  
  78. class FW_CPrintEnvironment
  79. {
  80. public:
  81.     FW_DECLARE_AUTO(FW_CPrintEnvironment)
  82.     
  83.                             FW_CPrintEnvironment();
  84.     virtual                 ~FW_CPrintEnvironment();
  85.     
  86. #ifdef FW_BUILD_MAC
  87.     void                    MacRestoreResFile();
  88. #endif
  89.  
  90.     // ------ Implementation
  91. private:
  92. #ifdef FW_BUILD_MAC
  93.     GrafPtr                    fOldPort;
  94.     short                    fMacResFile;
  95. #endif                
  96. };
  97.  
  98. //========================================================================================
  99. // class FW_CPrintInfo
  100. //========================================================================================
  101.  
  102. class FW_CPrintInfo
  103. {
  104. public:
  105.     FW_DECLARE_AUTO(FW_CPrintInfo)
  106.     
  107.                             FW_CPrintInfo(
  108.                                 Environment*            ev,
  109.                                 ODStorageUnit*             storageUnit,
  110.                                 FW_CPrintEnvironment*    printEnv);
  111.                                 // Attempts to initialize from the storage unit; if
  112.                                 // there is no print into there, uses default values
  113.  
  114.     virtual                    ~FW_CPrintInfo();
  115.     
  116.     // ----- Print info
  117.     void                    GetCopyCount(short& copyCount, FW_Boolean& collate) const;
  118.     void                    GetPages(long& firstPage, long& lastPage);
  119.     FW_CRect                GetPageBounds() const;
  120.  
  121.     void                    SaveToStorageUnit(Environment* ev, ODStorageUnit* storageUnit) const;
  122.  
  123. #ifdef FW_BUILD_WIN
  124.     LPPRINTDLG                WinGetPrintDlg();
  125.     void                    WinUpdatePageRect();
  126. #endif
  127. #ifdef FW_BUILD_MAC
  128.     THPrint                    MacGetTHPrint() const;
  129. #endif
  130. #ifdef FW_SUPPORT_GX
  131.     gxJob                    GetGXJob() const;
  132. #endif
  133.  
  134.     // ------ Implementation
  135. protected:
  136. #ifdef FW_BUILD_WIN
  137.     PRINTDLG                fWinPrintDlg;
  138.     RECT                    fWinPageBounds;
  139.  
  140.     void                    WinSetPrintDlgToDefaults();
  141. #endif
  142. #ifdef FW_BUILD_MAC
  143.     THPrint                    fMacPrintRec;
  144. #endif
  145. #ifdef FW_SUPPORT_GX
  146.     gxJob                    fGXJob;
  147.     static gxJob            LoadFromStorageUnitGX(
  148.                                 Environment* ev,
  149.                                 ODStorageUnit* storageUnit);
  150. #endif
  151. };
  152.  
  153. //========================================================================================
  154. // class FW_CPrintJob
  155. //========================================================================================
  156.  
  157. class FW_CPrintJob
  158. {
  159. public:
  160.     FW_DECLARE_AUTO(FW_CPrintJob)
  161.     
  162.                             FW_CPrintJob(
  163.                                 FW_CPrintInfo*            printInfo,
  164.                                 FW_CPrintHandler*        printHandler,
  165.                                 FW_CPrintEnvironment*    printEnv);
  166.     virtual                    ~FW_CPrintJob();
  167.  
  168.     virtual ODFacet*        OpenDocument(
  169.                                 Environment*        ev,
  170.                                 ODFrame*            frame,
  171.                                 ODSession*            session,
  172.                                 long                numPages,
  173.                                 const FW_CString&    title);
  174.  
  175.     virtual void            CloseDocument(
  176.                                 Environment*        ev,
  177.                                 ODFacet*            facet);
  178.                                 
  179.     virtual void            CloseDocumentOnError(
  180.                                 Environment*        ev,
  181.                                 ODFacet*            facet);
  182.     
  183.     virtual void            OpenPage(long pageNumber);
  184.     virtual void            ClosePage();
  185.     virtual void            ClosePageOnError();
  186.  
  187.     virtual void            FinishPrinting();
  188.  
  189.     // ------ Implementation
  190. protected:
  191.     FW_CPrintInfo*            fPrintInfo;
  192.     FW_CPrintHandler*        fPrintHandler;
  193.     FW_CPrintEnvironment*    fPrintEnv;
  194.     
  195.     void                    PrivCreatePlatformPrintJob(long    numPages, const FW_CString&    title);
  196.     ODCanvas*                PrivCreatePrintCanvas(Environment* ev, ODFacet* facet);
  197.     
  198.     void                    PrivAbortPlatformPrintJob();
  199.  
  200. #ifdef FW_SUPPORT_GX
  201.     gxViewPort                fGXViewPort;
  202.     gxShapeSpoolUPP            fGXSpoolUPP;
  203.     WindowPtr                fMacCanvasWindow;
  204.     
  205. #endif
  206. #ifdef FW_BUILD_WIN
  207.     int                        fWinSaveDCIndex;
  208. #endif
  209. #ifdef FW_BUILD_MAC
  210.     TPrPort*                fMacPrPort;
  211. #endif
  212.  
  213.     void                    DoCloseDocument(
  214.                                 Environment*        ev,
  215.                                 ODFacet*            facet,
  216.                                 FW_Boolean            checkErrors);
  217.  
  218.     void                    DoClosePage(
  219.                                 FW_Boolean            checkErrors);
  220. };
  221.  
  222. //========================================================================================
  223. // class FW_XPrint
  224. //========================================================================================
  225.  
  226. struct FW_XPrint
  227. {
  228.     static void CheckPrintError(FW_PlatformError error);
  229. #ifdef FW_SUPPORT_GX
  230.     static void                CheckGXJobError(gxJob job);
  231. #endif
  232. #ifdef FW_BUILD_MAC
  233.     static void                MacCheckPrintError();
  234. #endif
  235. };
  236.  
  237. #endif // FWPRINFO_H
  238.